package com.sicaolong.partterndesign._02strategy._02;


import java.util.Arrays;

public class Main {
    public static void main(String[] args) {
        Cat[] c = {new Cat("毛毛", 4), new Cat("阿奇", 3), new Cat("小丽", 6)};
        Sorter sorter = new Sorter<Cat>();
        sorter.sort(c, new CatComparator());
        System.out.println(Arrays.toString(c));
    }

    static class CatComparator implements MyComparator<Cat> {

        @Override
        public int compare(Cat o1, Cat o2) {
            return Integer.compare(o1.getAge(), o2.getAge());
        }
    }
}
